<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>

<body>

  <script>
    // <!--  时间转时间戳-->
    const date = new Date();

    console.log(date * 1)
    console.log(date.valueOf())
    console.log(Number(date))
    console.log(date.getTime())

    //时间戳转时间
    const number = date.valueOf();
    let dateFormat = new Date(number);
  </script>
</body>

</html>